package vn.edu.saigontech.ncms.util;

import java.io.File;

public class Global extends PropertiesFile {
	
	public static String KEY = "Global";
	
	public static String KEY_LANGUAGE = "language";
	
	public static String PATH_WEB = "";
	
	public static final Global INSTANCE = new Global();
	
	public int getIntValue(String key) {
		return Integer.valueOf(getValue(key));
	}
	
	public void setIntValue(String key, int value) {
		this.setValue(key, String.valueOf(value));
	}
	
	public long getLongValue(String key) {
		return Long.valueOf(getValue(key));
	}
	
	public void setLongValue(String key, long value) {
		this.setValue(key, String.valueOf(value));
	}
	
	public boolean getBooleanValue(String key) {
		return Boolean.valueOf(getValue(key));
	}
	
	public void setBooleanValue(String key, boolean value) {
		this.setValue(key, String.valueOf(value));
	}
	
	public double getDoubleValue(String key) {
		return Double.valueOf(getValue(key));
	}
	
	public void setDoubleValue(String key, double value) {
		this.setValue(key, String.valueOf(value));
	}
	
	public void saveIntValue(String key, int value) {
		this.saveValue(key, String.valueOf(value));
	}
	
	public void saveLongValue(String key, long value) {
		this.saveValue(key, String.valueOf(value));
	}
	
	public void saveBooleanValue(String key, boolean value) {
		this.saveValue(key, String.valueOf(value));
	}
	
	public void saveDoubleValue(String key, double value) {
		this.saveValue(key, String.valueOf(value));
	}

	public String getLocation() {
		return PATH_WEB + (PATH_WEB.trim().equals("")? "" : File.separator) + "WEB-INF" + File.separator + "conf" + File.separator + "global.properties";
	}

	public String getTitle() {
		return "Configuration File";
	}
}